package io.renren.modules.generator.service.impl;

import io.renren.modules.generator.entity.WgzGoingoutRegistrationEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.WgzRoomDataDao;
import io.renren.modules.generator.entity.WgzRoomDataEntity;
import io.renren.modules.generator.service.WgzRoomDataService;
import org.springframework.util.StringUtils;


@Service("wgzRoomDataService")
public class WgzRoomDataServiceImpl extends ServiceImpl<WgzRoomDataDao, WgzRoomDataEntity> implements WgzRoomDataService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<WgzRoomDataEntity> wgzRoomDataEntityQueryWrapper = new QueryWrapper<>();

        if (!StringUtils.isEmpty(params.get("building"))){
            wgzRoomDataEntityQueryWrapper.eq("building",params.get("building"));
        }
        if (!StringUtils.isEmpty(params.get("roomId"))){
            wgzRoomDataEntityQueryWrapper.eq("room_id",params.get("roomId"));
        }
        IPage<WgzRoomDataEntity> page = this.page(
                new Query<WgzRoomDataEntity>().getPage(params),
                wgzRoomDataEntityQueryWrapper
        );

        return new PageUtils(page);
    }

}